<template>
    <div class="department">
      <van-tree-select
          v-model:active-id="activeId"
          v-model:main-active-index="activeIndex"
          style="width: 100%;height:100%"
          :items="items"
      >
      </van-tree-select>
      <van-button
          style="position:absolute;right:150px;bottom:100px;border:1px solid #aaa" round type="success" @click="toNext">
        下一步
      </van-button>
    </div>
</template>

<script>
import {ref} from "vue";
import {useRouter} from "vue-router";

let id = 0
export default {
  name: "regDoctordepartment",
  components: {},
  data() {
    return {
      active: 1,
    };
  },
  setup() {
    //在控制台返回各科室的信息
    // const options = {
    //   method: 'POST',
    //   url: 'http://106.54.189.155:6768/department/findDepartmentList',
    // };
    // axios.request(options).then(response=> {
    //   this.list=response.data.data;
    //   console.log(response.data);
    // }).catch(function (error) {
    //   console.error(error);
    // });

    const activeId = ref(1);
    const activeIndex = ref(0);
    const items = [
      {
        text: '骨科',
        children: [
          { text: '科室一', id: 1 },
          { text: '科室二', id: 2 },
          { text: '科室三', id: 3 },
          { text: '科室四', id: 4 },
        ],
      },
      {
        text: '牙科',
        children: [
          { text: '科室一', id: 5 },
          { text: '科室二', id: 6 },
        ],
      },
      {
        text: '皮肤科',
        children: [
          { text: '科室一', id: 7 },
          { text: '科室二', id: 8 },
        ],
      },
      {
        text: '脑科',
        children: [
          { text: '科室一', id: 9 },
          { text: '科室二', id: 10 },
        ],
      },

    ];

    const router = useRouter();

    // function toNext() {
    //   router.push("/home/consultation/releaseRequirets/describe");
    // }
    return {
      items,
      activeId,
      activeIndex,
      // ...toRefs(data),
      // toNext,
    };
  },
  methods: {
    toNext() {
      this.$router.push("/home/consultation/doctorRegistIndex/docRegistration");
    },
  },
};
</script>

<style lang="scss" scope>
.department {
  width: 100%;
  display: flex;
  &_body {
    flex: 1;
    height: 100%;
  }
}
</style>
